package o;

import android.text.TextUtils;
import com.huawei.hmf.annotation.ApiDefine;
import com.huawei.hmf.annotation.Singleton;
import java.io.File;
import java.util.concurrent.Executors;

@ApiDefine(uri = bxz.class)
@Singleton
public class byp implements bxz {
    private byd ˊ;
    private byg ˎ;
    private int ˏ = -1;
    private String ॱ;

    public void ˏ(byg o_byg) {
        this.ˏ = 1;
        if ((o_byg == null || this.ˎ == null || o_byg.ˋ() != this.ˎ.ˋ()) && !TextUtils.isEmpty(this.ॱ)) {
            dnw.ˊ(new File(this.ॱ));
        }
        this.ˎ = o_byg;
        if (this.ˎ != null) {
            this.ॱ = byz.ˋ(String.valueOf(this.ˎ.ˋ()));
        }
        this.ˊ = null;
    }

    public void ˏ(byd o_byd) {
        this.ˏ = 0;
        if ((o_byd == null || this.ˊ == null || o_byd.ˊ() != this.ˊ.ˊ()) && !TextUtils.isEmpty(this.ॱ)) {
            dnw.ˊ(new File(this.ॱ));
        }
        this.ˊ = o_byd;
        if (this.ˊ != null) {
            this.ॱ = byz.ˎ(String.valueOf(this.ˊ.ˊ()));
        }
        this.ˎ = null;
    }

    public byg ˏ(long j) {
        if (this.ˏ == 1 && this.ˎ != null && j == this.ˎ.ˋ()) {
            return this.ˎ;
        }
        bqx.ˊ("DraftImpl", "no useful commentData");
        return null;
    }

    public byd ˏ(int i) {
        bqx.ˏ("DraftImpl", "getPostDraft:" + i);
        if (this.ˏ == 0 && this.ˊ != null && i == this.ˊ.ˊ()) {
            return this.ˊ;
        }
        bqx.ˊ("DraftImpl", "no useful publishPostData");
        return null;
    }

    public void ˊ() {
        ॱ();
        this.ˊ = null;
        this.ˎ = null;
        this.ˏ = -1;
    }

    private void ॱ() {
        if (!TextUtils.isEmpty(this.ॱ)) {
            Executors.newSingleThreadExecutor().execute(new Runnable(this) {
                final /* synthetic */ byp ˋ;

                {
                    this.ˋ = r1;
                }

                public void run() {
                    dnw.ˊ(new File(this.ˋ.ॱ));
                }
            });
        }
    }

    public void ˎ() {
        ˊ();
        byz.ˋ();
    }
}
